from django.contrib import admin
from .models import BlogArticle, BlogCategory, BlogComment, BlogStats

class BlogCategory_Manager(admin.ModelAdmin):
    list_display = ['name']

class BlogArticle_Manager(admin.ModelAdmin):
    list_display = ['title','content','username','created_at','category']
    def display_author(self, obj):
            return obj.author.username  # 这里假设你的用户模型有一个 `username` 属性来表示用户名

    display_author.short_description = '作者'  # 设置显示名称

class BlogComment_Manager(admin.ModelAdmin):
    list_display = ['blog','commentor','content','created_at']

class BlogStats_Manager(admin.ModelAdmin):
    list_display = ['blog','counts']

admin.site.register(BlogCategory,BlogCategory_Manager)
admin.site.register(BlogArticle,BlogArticle_Manager)
admin.site.register(BlogStats,BlogStats_Manager)
admin.site.register(BlogComment,BlogComment_Manager)


